<template>
  <div>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="prjno" label="项目编号" width="150"></el-table-column>
      <el-table-column prop="userName" label="申请人" width="120"></el-table-column>
      <el-table-column label="区域" width="150">
        <template slot-scope="scope">
          <span>{{ scope.row.province }}{{ scope.row.city }}{{ scope.row.zone }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="loanTime" label="申请时间" width="180"></el-table-column>
      <el-table-column label="申请银行" width="300">
        <template slot-scope="scope">
          <span v-if="scope.row.bankinfo_id == 4">华夏银行</span>
          <span v-else="scope.row.bankinfo_id == 4">其它</span>
        </template>
      </el-table-column>
      <el-table-column prop="loanStatus" label="申请资料" width="120"></el-table-column>
      <el-table-column prop="deposit_amount" label="定金" width="120"></el-table-column>
      <el-table-column label="操作" width="100">
        <template slot-scope="scope">
          <el-button type="text" @click="dialogVisible = true">查看</el-button>
          <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClick">
            <es></es>
            <span slot="footer" class="dialog-footer">
              <el-button @click="dialogVisible = false">取 消</el-button>
              <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
            </span>
          </el-dialog>
          <el-button type="text" size="small" @click="editClick(scope.row, scope.column, scope.$index)">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="block">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[3, 5, 100, 400]"
        :page-size="3"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalData">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  import baseUrl from '../common/http_url'
  import Qs from 'qs'
  import es from './es6'

  export default {
    name: "own-approval",
    data() {
      return {
        tableData: [],
        currentPage: 1,
        showCount: 3,
        totalData: 0,
        baseUrl: baseUrl,
        dialogVisible: false
      }
    },
    components:{
      es:es
    },
    created() {
      this.init();
    },
    methods: {
      init() {
        const that = this;
        const params = Qs.stringify({
          currentPage: that.currentPage,
          showCount: that.showCount,
          downPaymentStatus: 1
        });
        that.axios.post(that.baseUrl.localBaseUrl + 'taodingAudit/getTaodingAuditList/', params)
          .then(function (response) {
            that.tableData = response.data.data.list;
            that.totalData = response.data.data.total;
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      handleSizeChange(val) {
        this.showCount = val;
        this.init();
      },
      handleCurrentChange(val) {
        this.currentPage = val;
        this.init();
      },
      handleClick(row, column, index){
        console.log(row)
        console.log(column)
        console.log(index)
      },
      editClick(row, column, index){
        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      }
    },
    mounted() {
    }
  }
</script>

<style scoped>

</style>
